import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import static java.lang.Thread.sleep;
//系统环境  需要 relaxed   https://github.com/RelaxedJS/ReLaXed
//         和  html2jade  https://www.npmjs.com/package/html2jade
public class CallShell {
    public static void main(String[] args) throws IOException, InterruptedException {
        CallShell test = new CallShell();
        String name = "result";
        test.scriptCall(name);
    }
    private int scriptCall(String totalFile) throws IOException, InterruptedException {
        //使用shell时
        // shell 脚本路径/d/JEE_project/CallShell/relaxed_doc.sh 源文件路径/d/Temp/interactive_example/master.pug
        String command = "D:\\JEE_project\\CallShell\\relaxed_doc.bat " + totalFile;
        Process p = Runtime.getRuntime().exec(command);
        InputStream is = p.getInputStream();
        BufferedReader reader = new BufferedReader(new InputStreamReader(is,"gbk"));
        String line;
        while((line = reader.readLine())!= null){
            System.out.println(line);
        }
        p.waitFor();
        is.close();
        reader.close();
        p.destroy();
        return 10;
    }
}
